package org.rslai.tcedit.domain;

import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;
import org.hibernate.annotations.Index;
import org.hibernate.validator.Length;

/**
 * 目录
 * 
 * @author rslai
 */
@MappedSuperclass
public class Catalog extends UUIDSupport {

	public static final String ROOT_ID = "00000000000000000000000000000000";
	public static final String ROOT_NAME = "Root";

	private Version version; // 版本信息
	private String parentCatalogID; // 父分类ID
	private String name; // 分类名
	private String describing; // 分类描述
	private String sequence; // 顺序

	@OneToOne
	@JoinColumn(nullable = false, updatable = true, unique = false)
	public Version getVersion() { return version; }
	public void setVersion(Version version) { this.version = version; }

	@Column(nullable = false, length = 32)
	@Index(name = "parentCatalogID")
	public String getParentCatalogID() { return parentCatalogID; }
	public void setParentCatalogID(String parentCatalogID) { this.parentCatalogID = parentCatalogID; }

	@Column(nullable = false, length = 50)
	@Length(max = 50, message = "分类名请限制在50字以内")
	public String getName() { return name; }
	public void setName(String name) { this.name = name; }

	@Column(nullable = true, length = 100)
	@Length(max = 100, message = "分类描述请限制在100字以内")
	public String getDescribing() { return describing; }
	public void setDescribing(String describing) { this.describing = describing; }

	@Column(nullable = true, length = 5)
	public String getSequence() { return sequence; }
	public void setSequence(String sequence) { this.sequence = sequence; }

}
